# stories/urls.py

from django.urls import path
from . import views

app_name = 'stories'

urlpatterns = [
    # 首页
    path('', views.home, name='home'),#匹配根路径 首页

    # 用户认证
    path('register/', views.register, name='register'),
    path('login/', views.user_login, name='login'),
    path('logout/', views.user_logout, name='logout'),

    # AI故事生成
    path('ai-generator/', views.ai_story_generator, name='ai_story_generator'),
    path('edit-story/<int:story_id>/', views.edit_story, name='edit_story'),

    # 故事详情
    path('story/<int:story_id>/', views.story_detail, name='story_detail'),

    # 个人创作
    path('my-stories/', views.my_stories, name='my_stories'),

    # 故事库
    path('library/', views.story_library, name='story_library'),
    
    # 排行榜
    path('leaderboard/', views.leaderboard, name='leaderboard'),

    # 个人中心
    path('profile/', views.profile, name='profile'),
    path('change-password/', views.change_password, name='change_password'),

    # 管理员审核功能
    path('admin-review/', views.admin_review, name='admin_review'),
    path('review-story/<int:story_id>/', views.review_story, name='review_story'),
    path('admin-dashboard/', views.admin_dashboard, name='admin_dashboard'),

    # AJAX接口
    path('ajax/add-comment/<int:story_id>/', views.add_comment, name='add_comment'),
    path('ajax/delete-comment/<int:comment_id>/', views.delete_comment, name='delete_comment'),
    path('ajax/rate-story/<int:story_id>/', views.rate_story, name='rate_story'),
    path('ajax/search/', views.search_stories, name='search_stories'),
    
    # 用户类型检查
    path('check-user-type/', views.check_user_type, name='check_user_type'),
]